 <div class="layui-hide-xs">
    {include file="public/cate" /}
</div>
<div class="layui-container">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md8 content detail">
            <div class="fly-panel detail-box">
                <h1>{$tie.title}</h1>
                <div class="fly-detail-info">
                    <span class="layui-badge layui-bg-green fly-detail-column">{$tie.cname}</span>
                    <span class="layui-badge" style="background-color: #999;">{$tie.status==0 ? "未结" : "已结"}</span>
                    <div class="fly-admin-box" data-id="26103"></div>
                    <span class="fly-list-nums">
                        <a href="#comment">
                            <i class="iconfont" title="回答">&#xe60c;</i>{$tie.replay}</a>
                        <i class="iconfont" title="人气">&#xe60b;</i>{$tie.view}</span></div>
                <div class="detail-about">
                    <a class="fly-avatar" href="/u/12601008/">
                        <img src="__root__{$tie.face}" alt="Heat"></a>
                    <div class="fly-detail-user">
                        <a href="/u/12601008/" class="fly-link">
                            <cite>{$tie.nickname}</cite></a>
                        <span>{:Ftime($tie.ctime)}</span></div>
                    <div class="detail-hits" id="LAY_jieAdmin" data-id="26103">
                        <span style="padding-right: 10px; color: #FF7200">悬赏：{$tie.kiss}飞吻</span>
                        <span class="layui-btn layui-btn-xs jie-admin {$tie.coid ? 'layui-btn-danger':''}" type="collect" id="collect" data="{$tie.qid}" data-type="add">{$tie.coid ? '取消收藏':'收藏'}</span>
                    </div>
                </div>
                <div class="detail-body layui-text photos">
                    {if  condition='$tie.ext'}
                    <table class="layui-table">
                        <tbody>
                            <tr>
                                <td>版本：{$tie.ext.project} {$tie.ext.version}</td>
                                <td>浏览器：{$tie.ext.browser}</td></tr>
                        </tbody>
                    </table>
                    {/if}
                    {$tie.content}
                </div>
            </div>
            <div class="fly-panel detail-box" id="flyReply">
                <fieldset class="layui-elem-field layui-field-title" style="text-align: center;">
                    <legend>回帖</legend></fieldset>
                
                {if condition="!$replays"}
                <ul class="jieda" id="jieda"> <li class="fly-none">消灭零回复</li> </ul>
                {/if}

                <ul class="jieda" id="jieda">
                    {volist name="replays" id="reply"}
                    <a name="item-{$reply.rid}"></a>
                    <li data-id="105249">
                        
                        <div class="detail-about detail-about-reply">
                            <a class="fly-avatar" href="/u/12601008/">
                                <img src="__root__{$reply.face}" alt="Heat"></a>
                            <div class="fly-detail-user">
                                <a href="/u/12601008/" class="fly-link">
                                    <cite>{$reply.nickname}</cite></a>
                            </div>
                            <div class="detail-hits">
                                <span>{:Ftime($reply.ctime)}</span></div>
                        </div>
                        <div class="detail-body layui-text jieda-body photos">{$reply.content}</div>
                        <div class="jieda-reply">
                            <span class="jieda-zan {$reply.rzid ? 'zanok':''}" data="{$reply.rid}" type="zan">
                                <i class="iconfont icon-zan"></i>
                                <em>{$reply.zan_num}</em></span>
                            <span type="reply" class="reply" data="{$reply.nickname}">
                                <i class="iconfont icon-svgmoban53"></i>回复</span>
                        </div>
                    </li>
                    {/volist}
                </ul>
                <div style="text-align: center"></div>
                <a name="reply"></a>
                <div class="layui-form layui-form-pane">
                    <form action="/jie/reply/" method="post">
                        <div class="layui-form-item layui-form-text">
                            <div class="layui-input-block">
                                <textarea id="content" name="content" required  placeholder="请输入内容" class="layui-textarea fly-editor" style="height: 150px;"></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <input type="hidden" name="qid" value="{$tie.qid}">
                            <button class="layui-btn" lay-filter="add" lay-submit>提交回复</button></div>
                    </form>
                </div>
            </div>
        </div>
        <div class="layui-col-md4">
            {include file="public/weekHot" /}
            <div class="fly-panel">
                <div class="fly-panel-title">心级赞助商
                    <span style="padding: 0 3px;">-</span>
                    <a href="/jie/15697/" class="fly-link fly-joinad    ">我要加入</a></div>
                <div class="fly-panel-main">
                    <a href="http://www.ukewo.cn/" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: #1A7BFA;" time-limit="2018-05-13 0:0:0">优客服 - 开源的智能客服系统 + 呼叫中心</a>
                    <a href="http://www.uileader.com/" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: #43BAE9; font-size: 14px;" time-limit="2018-10-20 0:0:0">TouchUI Pro - 一套代码开发App、H5和小程序</a>
                    <a href="http://core.fineui.com/" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: #205B95;" time-limit="2018-07-18 0:0:0">FineUI - 9 年控件库 + ASP.NET Core 2.0</a>
                    <a href="http://www.ideacms.net" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: #F25123;" time-limit="2018-05-10 0:0:0">IdeaMall商城+小程序系统，小而美，仅6M</a>
                    <a href="https://nai8.me" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: #002845;" time-limit="2018-05-08 0:0:0">阿北的知识分享 - Yii/小程序/ES6原创视频</a>
                    <a href="https://juejin.im/welcome/backend?utm_source=layui&utm_medium=banner&utm_content=fangwen&utm_campaign=q2_website" target="_blank" rel="nofollow" class="fly-zanzhu fly-zanzhu-img" time-limit="2018-05-20 0:0:0">
                        <img src="//cdn.layui.com/upload/2018_4/168_1524128314283_57388.jpg" alt="掘金"></a>
                </div>
            </div>
            <div class="fly-panel">
                <div class="fly-panel-title">官方产品</div>
                <div class="fly-panel-main">
                    <a href="http://www.layui.com/admin/?from=fly" target="_blank" class="fly-zanzhu" time-limit="2017.09.25-2099.01.01" style="background-color: #20222A;">layuiAdmin - layui 官方后台管理模板</a>
                    <a href="http://layim.layui.com/?from=fly" target="_blank" class="fly-zanzhu" time-limit="2017.09.25-2099.01.01" style="background-color: #009688;">LayIM - layui 即时通讯旗舰之作</a></div>
            </div>
            <div class="fly-panel" style="padding: 20px 0; text-align: center;">
                <img src="//cdn.layui.com/upload/2017_8/168_1501894831075_19619.jpg" style="max-width: 100%;" alt="layui">
                <p style="position: relative; color: #666;">微信扫码关注 layui 公众号</p></div>
        </div>
    </div>
</div>
<script>
    //Demo
    layui.use(['form','jquery','layedit'], function(){
      var form = layui.form;
      $ = layui.jquery;
      var layedit = layui.layedit;

        layedit.set({
          uploadImage: {
            url: "{:url('index/tie/upload')}" //接口url
            ,type: 'post' //默认post
          }
        });

      xbscontent = layedit.build('content'); //建立编辑器
      //监听提交
      form.on('submit(add)', function(data){

         
        data.field.content  = layedit.getContent(xbscontent);

        $.ajax({
            url: '{:url('index/replay/add')}',
            type: 'POST',
            dataType: 'json',
            data: data.field,
        })
        .done(function(res) {
           if (res.code==0) {
                layer.msg(res.msg,function(){});
           }else{
                layer.alert(res.msg,function(){
                    location.reload();
                });
           }
        })
        .fail(function() {
            layer.msg('系统异常',function(){});
        })
        
        return false;
      });

      
      $('.reply').click(function () {



            window.location.hash = "#reply";

            nickname  = $(this).attr('data');

            oldData = layedit.getContent(xbscontent);

            nickname = "@" + nickname + '';

            location.href = location.href;

            link = "<a href='{:url('index/user/index')}?nickname="+nickname +">@"+nickname+"</a> ";

            // layedit.setContent(xbscontent,oldData+nickname);



      })

      $('#collect').click(function () {
          qid  = $(this).attr('data');

          $.ajax({
                url: '{:url('index/tie/collect')}',
                type: 'POST',
                dataType: 'json',
                data: {qid:qid},
            })
            .done(function(res) {
               if (res.code==0) {
                    layer.msg(res.msg,function(){});
               }else{
                    if(res.msg=='取消收藏'){
                        $('#collect').removeClass('layui-btn-danger');
                        $('#collect').html('收藏');
                    }else{
                        $('#collect').addClass('layui-btn-danger');
                        $('#collect').html('取消收藏');
                    }
               }
            })
            .fail(function() {
                layer.msg('系统异常',function(){});
            })

      })

      $('.jieda-zan').click(function () {

          rid  = $(this).attr('data');

          that = $(this);

          $.ajax({
                url: '{:url('index/replay/zan')}',
                type: 'POST',
                dataType: 'json',
                data: {rid:rid},
            })
            .done(function(res) {
               if (res.code==0) {
                    layer.msg(res.msg,function(){});
               }else{
                    if(res.msg=='取消点赞'){
                        that.removeClass('zanok');
                        that.find('em').html(that.find('em').html()-1);
                    }else{
                        that.addClass('zanok');
                        that.find('em').html(Number(that.find('em').html())+1);
                    }
               }
            })
            .fail(function() {
                layer.msg('系统异常',function(){});
            })

      })
    });
</script>
        